import { Carousel as AntdCarousel, Image } from 'antd';
import styles from './index.less';
import { history } from '@umijs/max';

const Carousel =({data}) => {
    return (
        <AntdCarousel autoplay={true} autoplaySpeed={4000} className={styles.carousel}>
            {
                data?.map((item) => (
                    <Image height={500} preview={false} src={item.url} onClick={() => {
                        if (item.jumpType === 1) {
                            history.push(`/detail/${item.param}`)
                        } else {
                            window.location.href = item?.param
                        }
                    }} />
                ))
            }
        </AntdCarousel>
    )
}

export default Carousel;